package cz.muni.fi.pa165.ddtroops.daoclasses;

import cz.muni.fi.pa165.ddtroops.daointerfaces.RaceDAO;
import cz.muni.fi.pa165.ddtroops.entities.Race;
import org.springframework.stereotype.Repository;

/**
 * Class RaceDAOImpl serves as Data Access Object class for entity Race.
 * RaceDAOImpl class extends generic abstract class BaseDAOImpl, see RaceDAO
 * for summary of supported methods.
 *
 * @author Jan Šťastný
 */
@Repository(value = "raceDAO")
public class RaceDAOImpl extends BaseDAOImpl<Race> implements RaceDAO
{

    @Override
    protected boolean isValid(Race object) {
        return (object.getName()!=null && !object.getName().isEmpty())
            && (object.getDescription()!=null && !object.getDescription().isEmpty())
            && (object.getStrength()!=null)
            && (object.getDexterity()!=null)
            && (object.getConstitution()!=null)
            && (object.getIntelligence()!=null)
            && (object.getWisdom()!=null)
            && (object.getCharisma()!=null);
    }

    @Override
    protected boolean isIn(Race object) {
        return getById(object.getId()) != null;
    }

}
